{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 16 字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【选择】下列关于Python中字符串说法错误的是：（ ）\n",
    "\n",
    "A.Python中可以用单引号（''）表示字符串  \n",
    "B.Python中可以用双引号（\"\"）表示字符串  \n",
    "C.Python中可以用三引号（''' '''）表示字符串  \n",
    "D.Python中字符类型是char，字符串的类型是str"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【填空】下列语句的运行结果是：（ ）  \n",
    "`\n",
    "str1 = \"I love Python\"\n",
    "print(str1[3:8])`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：ove P"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【填空】请写出用空格“ ”合并字符串“Jane”、“Doe”的Python语句：（ ）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：\" \".join([\"Jane\",\"Doe\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【选择】下列不是Python3中解决路径中特殊字符问题的选项是：（ ）\n",
    "\n",
    "A.s = \"D:\\\\test\"  \n",
    "B.s = r\"D:\\test\"  \n",
    "C.s = u\"D:\\test\"  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：C"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【填空】系列语句的运行结果是：（ ）  \n",
    "`\n",
    "s = [\"is\",\"a\",\"later\",\"am\"]\n",
    "s.sort(key=lambda x:len(list(x)))\n",
    "print(s)\n",
    "`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：['a', 'is', 'am', 'later']"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
